"use strict";

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

//值班员：20485080740   领导：20485080744  网信办：20485080749

// roleRank 1领导 2值班员 3地方网信办 4运营单位 5安全厂商 6专家
var userInfo = {
    id: "",
    orgID: "",
    roleRank: ""
};

var publicMethods = {
    backDetail: function backDetail() {
        store.dispatch("showFlag_action", 2);
    },
    togClass: function togClass(el, className) {
        if (el.classList) {
            el.classList.toggle(className);
        } else {
            var classes = el.className.split(' ');
            var existingIndex = classes.indexOf(className);

            if (existingIndex >= 0) classes.splice(existingIndex, 1);else classes.push(className);

            el.className = classes.join(' ');
        }
    },

    // 事件、预警操作区域显示权限
    eventAndWarnOperateShowFlagFormat: function eventAndWarnOperateShowFlagFormat(data, data2) {
        var operateFlag = {
            leaderAdviceShow: false,
            show: false,
            leaderCheck: false,
            agreeAndDisagree: false,
            csAndDfFeedBackList: false,
            csFeedBackTxt: false,
            dfFeedBackTxt: false,
            summary: false,
            close: false,
            release: false,
            txtAreaLabel: false,
            feedBackForm: false,
            dwRelease: false,
            dwTxt: false,
            dwReleaseList: false,
            zjBtn: false,
            feedBackFormSubmit: 99
        };
        var opAction = function opAction(call) {
            if (data.approvalUserID == userInfo.id) {
                call();
            }
        };
        var st = void 0;
        var rk = parseInt(userInfo.roleRank);
        this.isDF(function () {
            st = parseInt(data.status);
            switch (rk) {
                //领导操作区域
                case 1:
                    operateFlag.leaderAdviceShow = true;
                    operateFlag.summary = true;
                    opAction(function () {
                        operateFlag.show = true;
                        operateFlag.leaderCheck = true;
                        operateFlag.agreeAndDisagree = true;
                        operateFlag.txtAreaLabel = "批示意见";
                    });
                    break;
                case 2:
                    //值班员操作区域
                    operateFlag.leaderAdviceShow = true;
                    operateFlag.summary = true;
                    switch (st) {
                        // 在办（等待审批）
                        case 1:
                            opAction(function () {
                                operateFlag.show = true;
                                operateFlag.leaderCheck = true;
                                operateFlag.close = true;
                                operateFlag.txtAreaLabel = "请示意见";
                            });
                            break;
                        // 审批完成
                        case 4:
                            opAction(function () {
                                operateFlag.show = true;
                                operateFlag.release = true;
                                operateFlag.close = true;
                            });
                            break;
                        //下发完成（等待反馈）
                        case 5:
                            operateFlag.show = false;
                            operateFlag.csAndDfFeedBackList = true;
                            operateFlag.csFeedBackTxt = true;
                            operateFlag.dfFeedBackTxt = true;
                            break;
                        //下发完成（反馈完毕）
                        case 6:
                            operateFlag.csAndDfFeedBackList = true;
                            operateFlag.csFeedBackTxt = true;
                            operateFlag.dfFeedBackTxt = true;
                            opAction(function () {
                                operateFlag.show = true;
                                operateFlag.close = true;
                                operateFlag.txtAreaLabel = "总结";
                            });
                            break;
                        //办结
                        case 7:
                            operateFlag.csAndDfFeedBackList = true;
                            operateFlag.csFeedBackTxt = true;
                            operateFlag.dfFeedBackTxt = true;
                            break;
                    }
                    break;
                case 6:
                    operateFlag.leaderAdviceShow = true;
                    opAction(function () {
                        operateFlag.show = true;
                        operateFlag.txtAreaLabel = "研判意见";
                        operateFlag.zjBtn = true;
                    });
                    break;
            }
        }, function () {
            st = parseInt(data2.status);
            switch (rk) {
                case 3:
                    operateFlag.dfFeedBackTxt = true;
                    if (st === 0) {
                        operateFlag.show = true;
                        operateFlag.feedBackForm = publicData.dfForm();
                    } else {
                        var vv = publicData.dfForm().map(function (i) {
                            i.value = data2[i.name];
                            return i;
                        });
                        operateFlag.feedBackFormSubmit = vv;
                    }
                    if (!data2.downsSet) {
                        operateFlag.dwRelease = true;
                    } else {
                        operateFlag.dwTxt = true;
                        operateFlag.dwReleaseList = true;
                    }
                    break;
                case 4:
                    operateFlag.dwTxt = true;
                    if (st === 0) {
                        operateFlag.show = true;
                        operateFlag.feedBackForm = publicData.dfForm();
                    } else {
                        var _vv = publicData.dfForm().map(function (i) {
                            i.value = data2[i.name];
                            return i;
                        });
                        operateFlag.feedBackFormSubmit = _vv;
                    }
                    break;
            }
        });
        return operateFlag;
    },

    //信息详情类型格式化
    infoTypeTxtFormat: {
        val: ["", "网络武器", "多边关系", "涉我言论", "攻击事件", "重要政策", "国外观点", "国内动态"],
        init: function init(data) {
            var _this = this;

            var arr = data.split(",").map(function (i) {
                return _this.val[parseInt(i)];
            });
            return arr.join(",");
        }
    },
    //事件信息等级转文字
    eventLevelToString: function eventLevelToString(v) {
        return ['', '特别重大', '重大', '较大', '一般', '其他'][v];
    },
    warnLevelToString: function warnLevelToString(v) {
        return ['', '很高', '高', '中等', '低', '很低'][v];
    },

    //反馈统计格式化
    csAndDfFeedBackListFormat: {
        init: function init(arr) {
            return arr.map(function (i) {
                var s = parseInt(i.status);
                var es = parseInt(i.exStatus);
                if (i.readTime == null) {
                    i.stateTxt = "未查看";
                } else {
                    i.stateTxt = publicData.csAndDfFeedBackListState[s];
                }
                if (es === -1 || es === 2) {
                    if (s === 1) {
                        i.btnFlag = 2;
                    } else {
                        i.btnFlag = 1;
                    }
                } else {
                    i.btnFlag = 3;
                }
                if (s === 0 && es === -1) {
                    i.historyBtnShow = false;
                } else {
                    i.historyBtnShow = true;
                }
                return i;
            });
        }
    },
    //角色权限判断
    isDF: function isDF(call1, call2, rank) {
        rank = rank || userInfo.roleRank;
        if (rank === 1 || rank === 2 || rank === 6) {
            call1();
        } else {
            call2();
        }
    }
};

var publicData = {
    leader: [],
    releaseCs: [],
    releaseDf: [],
    dfList: [],
    csList: [],
    dwList: [],
    peopleList: [],
    keyGetPeopleList: ["0", "leader", "2", "dfList", "4", "csList", "6", "dwList", "8"],
    keyIDPeopleList: ["0", "linkdoodID", "2", "orgID", "4", "orgID", "orgID", "id", "8"],
    keyOrgNameDetail: ["0", "linkdoodName", "2", "orgName", "4", "orgName", "6", "orgName", "8"],
    keyDetailsVal: ["0", "leader", "2", "releaseDf", "4", "releaseCs", "6", "dwList", "8"],
    newsAddChecked: [],
    dwTxtKey: function dwTxtKey() {
        return ["", "", "eventManageTable", "riskManageTable"][getHeader.type];
    },

    srn: 1,
    peopleListKey: "",
    checkedFeedBackDetail: "",
    continueFeedBackTxt: "",
    csAndDfFeedBackListState: ["待反馈", "待确认", "已完成"],
    feedBackKeys: {
        time: {
            label: "操作时间",
            value: ""
        },
        list: {
            operator: {
                label: "操作人",
                class: "inline-wrap",
                value: ""
            },
            response: {
                label: "情况说明",
                value: "",
                class: ""
            },
            superviseCase: {
                label: "监测情况",
                value: "",
                class: ""
            },
            affectedUnits: {
                label: "受影响单位数",
                value: "",
                class: "inline-wrap"
            },
            cleanKeyFacility: {
                label: "已清除病毒关键信息技术设施数量",
                class: "inline-wrap",
                value: ""
            },
            devices: {
                label: "排查设备数量",
                class: "inline-wrap",
                value: ""
            },
            dumpDevices: {
                class: "inline-wrap",
                label: "已清除病毒设备数量",
                value: ""
            },
            infectedDevices: {
                class: "inline-wrap",
                label: "感染病毒设备数量",
                value: ""
            },
            keyFacilityNumber: {
                class: "inline-wrap",
                label: "感染病毒关键信息技术设施数量",
                value: ""
            },
            units: {
                class: "inline-wrap",
                label: "排查单位数量",
                value: ""
            }
        },
        eventList: {
            operator: {
                label: "操作人",
                class: "inline-wrap",
                value: ""
            },
            situation: {
                label: "情况说明",
                value: "",
                class: ""
            },
            superviseCase: {
                label: "监测情况",
                value: "",
                class: ""
            },
            systemName: {
                label: "系统名称",
                value: "",
                class: "inline-wrap"
            },
            ip: {
                label: "IP地址",
                value: "",
                class: "inline-wrap"
            },
            domain: {
                label: "域名",
                class: "inline-wrap",
                value: ""
            },
            behindUrl: {
                label: "漏洞URL",
                class: "inline-wrap",
                value: ""
            },
            osVersion: {
                class: "inline-wrap",
                label: "操作系统版本",
                value: ""
            },
            appName: {
                class: "inline-wrap",
                label: "应用软件名称及版本",
                value: ""
            },
            systemPurpose: {
                class: "inline-wrap",
                label: "系统用途",
                value: ""
            },
            unit: {
                class: "inline-wrap",
                label: "所属单位",
                value: ""
            },
            attackSource: {
                class: "inline-wrap",
                label: "攻击来源IP地址",
                value: ""
            },
            attackRegion: {
                class: "inline-wrap",
                label: "攻击来源地域(国家,地区)",
                value: ""
            }
        },
        init: function init(data) {
            var key = void 0;
            var list = this.list;
            if (getHeader.type === 2) {
                list = this.eventList;
            }
            for (key in data) {
                var keyVal = data[key];
                if (list[key]) {
                    list[key].value = keyVal;
                }
                if (key === "updateTime") {
                    if (typeof keyVal == "number") {
                        this.time.value = formatDate(keyVal, "yyyy-MM-dd hh:MM");
                    } else {
                        this.time.value = keyVal;
                    }
                }
            }
            return {
                list: list,
                time: this.time
            };
        },
        historyListInit: function historyListInit(data) {
            var _this2 = this;

            return data.map(function (i) {
                var vv = void 0;
                var item = {};
                try {
                    vv = JSON.parse(i.content);
                    if ((typeof vv === "undefined" ? "undefined" : _typeof(vv)) == "object") {
                        vv.operator = i.operator;
                        item = _this2.init(vv);
                    } else {
                        item = publicData.feedBackResult.init(i);
                    }
                } catch (e) {
                    item = publicData.feedBackResult.init(i);
                }
                return JSON.stringify(item);
            });
        }
    },
    feedBackResult: {
        time: {
            label: "操作时间",
            value: ""
        },
        keys: {
            operator: {
                label: "操作人",
                class: "inline-wrap",
                value: ""
            },
            content: {
                label: "操作内容",
                value: ""
            }
        },
        init: function init(arr) {
            var val = arr;
            var key = void 0;
            for (key in val) {
                if (this.keys[key]) {
                    this.keys[key].value = val[key];
                }
                if (key == "time") {
                    this.time.value = val[key];
                }
            }
            return {
                list: this.keys,
                time: this.time
            };
        }
    },
    dfForm: function dfForm() {
        return ["", "", this.dfFormEvent, this.dfFormRisk][getHeader.type];
    },

    dfFormRisk: [{
        label: "排查单位数量(个)",
        name: "units",
        type: "number",
        flag: 1
    }, {
        label: "排查设备数量(个)",
        name: "devices",
        type: "number",
        flag: 1
    }, {
        label: "受影响单位数(个)",
        name: "affectedUnits",
        type: "number",
        flag: 1
    }, {
        label: "感染病毒设备数量(个)",
        name: "infectedDevices",
        type: "number",
        flag: 1
    }, {
        label: "感染病毒关键信息技术设施数量(个)",
        name: "keyFacilityNumber",
        type: "number",
        flag: 1
    }, {
        label: "已清除病毒设备数量(个)",
        name: "dumpDevices",
        type: "number",
        flag: 1
    }, {
        label: "已清除病毒关键信息技术设施数量(个)",
        name: "cleanKeyFacility",
        type: "number",
        flag: 1
    }, {
        label: "应对情况",
        name: "response",
        flag: 2
    }],
    dfFormEvent: [{
        label: "系统名称",
        name: "systemName",
        type: "text",
        flag: 1
    }, {
        label: "IP地址",
        name: "devices",
        type: "text",
        flag: 1
    }, {
        label: "域名",
        name: "domain",
        type: "text",
        flag: 1
    }, {
        label: "漏洞URL",
        name: "behindUrl",
        type: "text",
        flag: 1
    }, {
        label: "操作系统版本",
        name: "osVersion",
        type: "text",
        flag: 1
    }, {
        label: "应用软件名称及版本",
        name: "appName",
        type: "text",
        flag: 1
    }, {
        label: "系统用途",
        name: "systemPurpose",
        type: "text",
        flag: 1
    }, {
        label: "所属单位",
        name: "unit",
        type: "text",
        flag: 1
    }, {
        label: "攻击来源IP地址",
        name: "attackSource",
        type: "text",
        flag: 1
    }, {
        label: "攻击来源地域(国家,地区)",
        name: "systemPurpose",
        type: "text",
        flag: 1
    }, {
        label: "情况说明",
        name: "situation",
        flag: 2
    }]
};

var ajax_ = {
    url: "/Cyberspace/sys/",
    archiveUrl: "baseTable/archive/", //归档ajax
    newsUrl: "todayBulletin", //快报列表
    eventUrl: "eventManage", //事件列表
    warnUrl: "riskManage", //预警列表
    eventAndWarnUpdateUrl: "eventApproval", //预警和事件更新状态
    eventAndWarnDetail: ["", "", "eventManage/", "riskManage/"], //信息详情
    infoDetail: "baseTable/", //信息详情
    eventAndRiskRelease: ["", "", "eventManage/release", "riskManage/release"], //值班员下发
    eventAndFeedbackList: ["", "", "eventFeedbackTable/list", "riskFeedbackTable/list"], //地方网信办事件列表
    feedBackDetail: ["", "", "eventFeedbackTable/detail", "riskFeedbackTable/detail"], //地方网信办详情
    eventAndRiskFeedbackSummary: ["", "", "eventFeedbackTable/summary", "riskFeedbackTable/summary"], //地方网信办统计列表
    feedBackSubmit: ["", "", "eventFeedbackTable/submit", "riskFeedbackTable/submit"], //地方网信办统计列表
    dfRelease: ["", "", "eventFeedbackTable/release", "riskFeedbackTable/release"], //地方网信办下发运营单位
    dwFeedBackList: function dwFeedBackList() {
        return ["", "", "eventFeedbackTable/total", "riskFeedbackTable/total"][getHeader.type];
    },
    //地方网信办下发运营单位
    circulationRecordTable: "circulationRecordTable/add", //反馈操作
    feedBackHistoryList: "circulationRecordTable/list", //流转详情
    orgList: "organizeTable/listOperators", //流转详情
    timeOut: 30000,
    code0Txt: "处理失败，请联系管理员",
    error: function error() {
        mui.toast('服务器没有响应，请稍后重试！');
    },
    code0: function code0(data, call) {
        if (data.code == 0) {
            mui.toast(data.msg);
        } else {
            call();
        }
    },
    loading: function loading(val) {
        store.commit("_loadingShow", val);
    },
    getTypeData: function getTypeData(url, data, call) {
        var self = this;
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: 'get',
            timeout: this.timeOut,
            success: function success(data) {
                self.code0(data, function () {
                    call(data);
                });
            },
            error: function error() {
                self.error();
            }
        });
    },
    getType: function getType(url, data, call) {
        var self = this;
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: 'get',
            timeout: this.timeOut,
            success: function success(data) {
                self.code0(data, function () {
                    call(data.result);
                });
            },
            error: function error() {
                self.error();
            }
        });
    },
    postType: function postType(url, data, call) {
        var self = this;
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: 'post',
            timeout: this.timeOut,
            success: function success(data) {
                self.code0(data, function () {
                    call(data);
                });
            },
            error: function error() {
                self.error();
            }
        });
    },
    deleteType: function deleteType(url, data, call) {
        var self = this;
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: 'delete',
            timeout: this.timeOut,
            success: function success(data) {
                self.code0(data, function () {
                    call(data);
                });
            },
            error: function error() {
                self.error();
            }
        });
    },
    putTypeWithLoading: function putTypeWithLoading(url, data, call) {
        var self = this;
        self.loading(true);
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: 'put',
            timeout: this.timeOut,
            success: function success(data) {
                self.loading(false);
                self.code0(data, function () {
                    call(data);
                });
            },
            error: function error() {
                self.loading(false);
                self.error();
            }
        });
    },
    confirmPutTypeWithLoading: function confirmPutTypeWithLoading(url, data, call) {
        var _this3 = this;

        confirm_(function () {
            _this3.putTypeWithLoading(url, data, call);
        }, function () {
            _this3.loading(false);
        });
    },
    noLoading: function noLoading(url, type, data, call) {
        var self = this;
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: type,
            timeout: this.timeOut,
            success: function success(data) {
                call(data);
            },
            error: function error() {
                self.error();
            }
        });
    },
    withLoading: function withLoading(url, type, data, call) {
        var self = this;
        self.loading(true);
        mui.ajax(this.url + url, {
            data: data,
            dataType: 'json',
            type: type,
            timeout: this.timeOut,
            success: function success(data) {
                self.loading(false);
                call(data);
            },
            error: function error() {
                self.loading(false);
                self.error();
            }
        });
    },
    confirmWithLoading: function confirmWithLoading(url, type, data, call) {
        var _this4 = this;

        confirm_(function () {
            _this4.withLoading(url, type, data, call);
        }, function () {
            _this4.loading(false);
        });
    },

    // 归档
    _archiveUrl: function _archiveUrl(options) {
        this.loading(true);
        this.confirmPutTypeWithLoading(this.archiveUrl + options.id, options.data, function () {
            alertBackRefreshList();
        });
    },

    //获取下发运营单位
    orgListGet: function orgListGet(id) {
        this.postType(this.orgList, { orgID: id }, function (data) {});
    }
};

var alert_ = function alert_(call, txt) {
    txt = txt || "处理成功";
    mui.alert('处理成功', '', function () {
        call && call();
    });
};

var alertBackRefreshList = function alertBackRefreshList() {
    alert_(function () {
        scrollTriggerDownScroll();
        goBack();
    });
};

var confirm_ = function confirm_(call, cancel, txt) {
    txt = txt || "是否确认处理";
    mui.confirm(txt, '', ['取消', '确认'], function (e) {
        if (e.index == 1) {
            call && call();
        } else {
            cancel && cancel();
        }
    });
};

var vrv = vrv || {};

var vrvInit = {
    userInfo: "",
    letters: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
    contactList: [],
    contactListForSearch: [],
    getImgUrl: function getImgUrl(v) {
        return v ? v : "./img/q.png";
    },
    init: function init() {
        vrv.ready(function () {
            vrv.jssdk.showNavigationBar({ show: false });
            vrv.jssdk.getAccountInfo({
                success: function success(res) {
                    userInfo.id = res.mUserId;
                    getUserType(function () {
                        APP.$emit("isPush", 1);
                    });
                }
            });
        });
    },
    getContacts: function getContacts() {
        //获取好友
        // vrv.jssdk.getContactList({
        //     success: function (res) {
        //         let peoples = {};
        //         let others = {letter: "#", arr: []};
        //         res.contacts.forEach((v) => {
        //             let l = Letter(v.buddyName).toString().charAt(0);
        //             v.imgUrl = vrvInit.getImgUrl(v.portraitURL);
        //             self.contactListForSearch.push(v);
        //             if (!self.letters.match(l)) {
        //                 others.arr.push(v);
        //             } else {
        //                 if (!peoples[l]) {
        //                     peoples[l] = {letter: '', arr: []};
        //                     peoples[l].letter = l;
        //                     peoples[l].arr.push(v);
        //                 } else {
        //                     peoples[l].arr.push(v);
        //                 }
        //             }
        //         });
        //         if (others.arr.length) {
        //             peoples.others = others;
        //         }
        //         if (!Object.keys(peoples).length) {
        //             peoples = false;
        //         } else {
        //             peoples = Object.keys(peoples).sort().map((i) => {
        //                 return peoples[i];
        //             });
        //         }
        //         self.contactList = peoples;
        //         // store.commit("_peopleList", peoples);
        //     }
        // })
    },
    closeWindow: function closeWindow() {
        vrv.jssdk.closeView({});
    }
};

// type 1：今日快报  2：事件管理  3：预警管理
var getHeader = {
    type: "",
    txt: "",
    init: function init(v) {
        var str = "";
        switch (v) {
            case 1:
                str = "\u4ECA\u65E5\u5FEB\u62A5";
                break;
            case 11:
                str = "\u6DFB\u52A0\u9009\u9898";
                break;
            case 12:
                str = "\u5FEB\u62A5\u8BE6\u60C5";
                break;
            case 20:
                str = this.txt + "\u7BA1\u7406";
                break;
            case 2:
                str = this.txt + "\u8BE6\u60C5";
                break;
            case 21:
                str = "\u901A\u8BAF\u5F55";
                break;
            case 111:
                str = "\u8BF7\u9009\u62E9";
                break;
        }
        return str;
    },
    getHeaderTxt: function getHeaderTxt() {
        var h = "";
        switch (parseInt(this.type)) {
            case 1:
                h = "今日快报";
                break;
            case 2:
                h = "事件";
                break;
            case 3:
                h = "预警";
                break;
        }
        return h;
    }
};

//事件基本信息
var eventKeys = {
    init: function init(v) {
        return {
            title: "详情信息",
            data: [{
                label: "标题",
                type: 1,
                value: v.title
            }, {
                label: "事件类型",
                type: 1,
                value: v.firstEventType.name + " — " + v.secondEventType.name
            }, {
                label: "事件等级",
                type: 1,
                value: eventKeys.eventLevelToString(v.primaryEventGrade)
            }, {
                label: "发生日期",
                type: 1,
                value: v.happenTime
            }, {
                label: "报送单位",
                type: 1,
                value: v.createUserInfo.orgName
            }, {
                label: "填报人",
                type: 1,
                value: v.createUserInfo.linkdoodName
            }, {
                label: "联系电话",
                type: 1,
                value: v.createUserInfo.cellphone
            }, {
                label: "传真",
                type: 1,
                value: v.fax
            }, {
                label: "事发单位及系统功能描述",
                type: 2,
                value: v.unitSystemDescription
            }, {
                label: "事态发展概述及初判原因",
                type: 2,
                value: v.primaryJudgment
            },
            // {
            //     label:"影响范围",
            //     type:2,
            //     value:v
            // },
            {
                label: "影响地域",
                type: 2,
                value: v.regionListString
            }, {
                label: "影响行业",
                type: 2,
                value: v.industryListString
            }, {
                label: "影响和危害描述",
                type: 2,
                value: v.influenceHarm
            }, {
                label: "已采取的措施及效果",
                type: 2,
                value: v.measureToken
            }, {
                label: "请求事项及工作建议",
                type: 2,
                value: v.itemsAdvise
            }, {
                label: "备注",
                type: 2,
                value: v.remarks
            }]
        };
    },
    eventLevelToString: function eventLevelToString(v) {
        return ['', '特别重大', '重大', '较大', '一般', '其他'][v];
    }
};

//预警基本信息
var warnKeys = {
    init: function init(v) {
        return {
            title: "详情信息",
            data: [{
                label: "标题",
                type: 1,
                value: v.title
            }, {
                label: "风险类型",
                type: 1,
                value: v.riskType.name
            }, {
                label: "风险等级",
                type: 1,
                value: warnKeys.warnLevelToString(v.primaryRiskGrade)
            }, {
                label: "预警等级",
                type: 1,
                value: warnKeys.riskTypeToString(v.warningLevel)
            }, {
                label: "发生日期",
                type: 1,
                value: v.happenTime
            }, {
                label: "报送单位",
                type: 1,
                value: v.createUserInfo.orgName
            }, {
                label: "填报人",
                type: 1,
                value: v.createUserInfo.linkdoodName
            }, {
                label: "联系电话",
                type: 1,
                value: v.createUserInfo.cellphone
            }, {
                label: "传真",
                type: 1,
                value: v.fax
            }, {
                label: "情况描述",
                type: 2,
                value: v.basicSituationDescription
            },
            // {
            //     label:"影响范围",
            //     type:2,
            //     value:v
            // },
            {
                label: "影响地域",
                type: 2,
                value: v.regionListString
            }, {
                label: "影响行业",
                type: 2,
                value: v.industryListString
            }, {
                label: "影响和危害描述",
                type: 2,
                value: v.influenceHarm
            }, {
                label: "验证方法",
                type: 2,
                value: v.verificationMethod
            }, {
                label: "趋势及危害",
                type: 2,
                value: v.trendHazards
            }, {
                label: "已采取措施及效果",
                type: 2,
                value: v.measureToken
            }, {
                label: "建议应对措施",
                type: 2,
                value: v.suggestion
            }, {
                label: "备注",
                type: 2,
                value: v.remarks
            }]
        };
    },
    warnLevelToString: function warnLevelToString(v) {
        return ['', '很高', '高', '中等', '低', '很低'][v];
    },
    riskTypeToString: function riskTypeToString(v) {
        return ['无', '红', '橙', '黄', '蓝'][v];
    }
};

//请示意见列表点击记录格式化
var detailsFun = {
    approvalListLastID: "",
    operateTxt: ["", "请示领导", "专家研判", "退回", "研判完毕", "同意", "请示领导", "同意", "下发", "下发完毕", "反馈中", "反馈完毕", "等待归档", "归档"],
    //获取批示人ID
    approvalListFormat: function approvalListFormat(val, status) {
        var _this5 = this;

        var newArr = [];
        var btnFlag = false;
        val.forEach(function (i) {
            if (i.advice != null) {
                i.operateTxt = _this5.operateTxt[parseInt(i[status])];
                newArr.push(i);
            } else {
                _this5.approvalListLastID = i.id;
            }
        });
        return {
            newArr: newArr,
            btnFlag: btnFlag
        };
    }
};

//获取用户角色
var getUserType = function getUserType(call) {
    ajax_.getTypeData("user/" + userInfo.id, {}, function (data) {
        if (parseInt(data.code) === 0) {
            //用户不存在
            alert_(function () {}, data.msg);
        } else {
            var rank = parseInt(data.result.role.id);
            userInfo.roleRank = rank;
            store.commit("_roleRank", rank);
            call();
        }
    });
};

//判断是否为推送
var isPush = {
    val: GetQueryString("isPush"),
    flag: false,
    init: function init(call) {
        if (this.val == 1) {
            //推送消息加载详情
            getHeader.type = parseInt(GetQueryString("type"));
            getHeader.txt = getHeader.getHeaderTxt();
            this.flag = true;
            browserRedirect();
            vrvInit.init();
        } else {
            // 正常加载
            // 值班员：20485080740   领导：20485080744  网信办：20485080749
            // var u = {
            //     "userInfo": {
            //         "createUserInfo": {
            //             "linkdoodID": "20485080744",
            //             "linkdoodName": "领导",
            //             "photoUrl": null,
            //             "cellphone": "13888888888",
            //             "orgName": "test",
            //             "orgID": "1",
            //             "isOnDuty": 1,
            //             "isSuper": 0,
            //             "roleID": 1,
            //             "role": {"id": 1, "name": "领导", "roleRank": "1", "roleType": "ROLE_LEAD"}
            //         }
            //     }
            // };
            // sessionStorage.setItem("urlVal",JSON.stringify(u));
            APP.$off("isPush");
            call();
        }
    }
};

function formatDate(date, fmt) {
    date = date == undefined ? new Date() : date;
    date = typeof date == 'number' ? new Date(date) : date;
    fmt = fmt || 'yyyy-MM-dd HH:mm:ss';
    var obj = {
        'y': date.getFullYear(), // 年份，
        'M': date.getMonth() + 1, // 月份，
        'd': date.getDate(), // 日期
        'q': Math.floor((date.getMonth() + 3) / 3), // 季度
        'w': date.getDay(), // 星期，
        'H': date.getHours(), // 24小时制
        'h': date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, // 12小时制
        'm': date.getMinutes(), // 分钟
        's': date.getSeconds(), // 秒
        'S': date.getMilliseconds() // 毫秒
    };
    var week = ['日', '一', '二', '三', '四', '五', '六'];
    for (var i in obj) {
        fmt = fmt.replace(new RegExp(i + '+', 'g'), function (m) {
            var val = obj[i] + '';
            if (i == 'w') return (m.length > 2 ? '星期' : '周') + week[val];
            for (var j = 0, len = val.length; j < m.length - len; j++) {
                val = '0' + val;
            }return m.length == 1 ? val : val.substring(val.length - m.length);
        });
    }
    return fmt;
}

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var params = "";
    var val = "";
    if (window.location.search) {
        params = window.location.search.substr(1).match(reg);
    } else if (window.location.hash && window.location.hash.split("?")[1]) {
        params = window.location.hash.split("?")[1].match(reg);
    }
    if (params != null) {
        val = decodeURI(params[2]);
    }
    return val;
}

//判断是否为手机端
function browserRedirect() {
    var sUserAgent = navigator.userAgent.toLowerCase();
    var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
    var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
    var bIsMidp = sUserAgent.match(/midp/i) == "midp";
    var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
    var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
    var bIsAndroid = sUserAgent.match(/android/i) == "android";
    var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
    var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
    if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
        //移动端
    } else {
        //PC端
        var type = GetQueryString("type");
        var id = GetQueryString("id");
        var url = "";
        switch (parseInt(type)) {
            case 1:
                url = "../../../Cyberspace/#/todayDesc?id=" + id;
                break;
            case 2:
                url = "../../../Cyberspace/#/eventRiskDesc?id=" + id + "&type=3";
                break;
            case 3:
                url = "../../../Cyberspace/#/eventRiskDesc?id=" + id + "&type=2";
                break;
        }
        window.location = url;
    }
}